package jmine.tec.script.persistent.driver;

import java.util.Arrays;
import java.util.regex.Matcher;

/**
 * Parser de Import: api1, api2, api3
 * 
 * @author lundberg
 * @param <T> tipo de scriptbean aceito
 */
public class ImportParser<T extends ScriptBean> extends AbstractScriptParameterParser<T> {

    /**
     * Construtor
     */
    public ImportParser() {
        super("(?i)\\s*Import:\\s*(\\w+(?:\\s*,\\s*\\w+)*)\\s*");
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void doParse(T bean, Matcher matcher) {
        bean.getApis().addAll(Arrays.asList(matcher.group(1).trim().split("\\s*,\\s*")));
    }
}
